{% extends "layout.html" %}
{% set now_title = '管理员列表'%}

{% block web_title %}{{ now_title }}-{{ parent()}}{% endblock%}
{% block content%}
<!-- Main Container Start -->
<div class="main-container">
    <!-- Top Bar Starts -->
    <div class="top-bar clearfix">
        <div class="page-title">
            <h4>
                <div class="fs1 iconfont icon-setting" aria-hidden="true"></div>
                {{ now_title }}</h4>
        </div>
    </div>
    <!-- Top Bar Ends -->

    <!-- Container fluid Starts -->
    <div class="container-fluid">

        <!-- Spacer starts -->
        <div class="spacer-xs">
            <!-- Row start -->
            <div class="row no-gutter">
                <div class="col-md-12 col-sm-12 col-sx-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4>{{ now_title }}</h4>
                            <ul class="links">
                                <li>
                                    <a href="/admin/infoadmin">
                                        <i class="fa iconfont icon-plus"></i>
                                    </a>
                                </li>
                            </ul>
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-condensed table-striped table-bordered table-hover no-margin">
                                    <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>用户名</th>
                                        <th>是否可用</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for a in data %}
                                    <tr>
                                        <td>{{ a.id }}</td>
                                        <td>{{ a.username }}</td>
                                        <td>{{ a.is_use==0 ? '可用' : '不可用' }}</td>
                                        <td>
                                            <a href="/admin/infoadmin/id/{{ a.id}}" class="label label-info" data-original-title="">编辑</a>
                                            <a data-url="/admin/deladmin/id/{{ a.id}}" href="javascript:;" class="label label-danger btn-del" data-original-title="">删除</a>
                                        </td>
                                    </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Row end -->
        </div>
        <!-- Spacer ends -->

    </div>
    <!-- Container fluid ends -->

</div>
<!-- Main Container Start -->

{% endblock%}

{% block script%}
<script>
    $('.btn-del').click(function(){
        var url = $(this).attr('data-url');
        //询问框
        layer.confirm('是否要删除这个管理员？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            location.href = url;
        }, function(){

        });
    })



</script>
{% endblock%}

